package com.etc.medical.feign;

import com.etc.common.utils.Result;
import com.etc.medical.client.MedicalRecordClient;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/medicalRecord")
@CrossOrigin(origins = "*")
public class MedicalRecordFeign {
    @Resource
    private MedicalRecordClient medicalRecordClient;

    /**
     * 根据医生id模糊查询病人的病历
     */
    @RequestMapping("/queryByDocIdLike")
    public Result queryByDocIdLike(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize,
                                   @RequestParam("docId") String docId, @RequestParam("like") String like) {
        return medicalRecordClient.queryByDocIdLike(pageNum, pageSize, docId, like);
    }

    /**
     * 根据医生id查询病人的病历
     *
     * @param docId
     * @return
     */
    @RequestMapping("/queryByDocId")
    public Result queryByDocId(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize,
                               @RequestParam("docId") String docId) {
        return medicalRecordClient.queryByDocId(pageNum, pageSize, docId);
    }
}
